#include "debug.h"
#include "../DDIC/AllDDIC.h"
#include "usbd_cdc.h"
#include "../DEMURA/Demura.h"
#include "fsmc.h"

u8 bufferR[50];
u8 bufferG[50];
u8 bufferB[50];

void  SSD2828_W_RAM_demura_buffer_part(float pclk,u8 SigMode ,u8* buffer ,u16 length,u8  multiple ,u8 DisMode)
{
  	u32 i;
    u32 Data_Num = 0;
    Data_Num = length*multiple*3;

		#ifdef SSD_Command_16
		for(i=0;i<(Data_Num/6);i++)
		{
			Write_DATA((buffer[i*6+2]<<8)+buffer[i*6+1]);//210, 543
			delay_6ns(1);
			Write_DATA((buffer[i*6+4]<<8)+buffer[i*6+3]);
			delay_6ns(1);
			Write_DATA((buffer[i*6+6]<<8)+buffer[i*6+5]);								
			delay_6ns(1);	
		}
		#else	
		for(i=0;i<Data_Num/3;i++)
		{
			Write_DATA(buffer[i*3+2]);
			Write_DATA(buffer[i*3+1]);
			Write_DATA(buffer[i*3]);          
		}
		#endif 
}

void VT6110C_601_Write_Demura_Ram(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8 buffer[],u16 LP_B7_Data,u16 HS_B7_Data)
{
	
		USB_Rx_Demura_End_Flag=0;	
	  SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);	
		if(USB_Rx_Demura==0)//第一笔数据
		{												
			Demura_first_package_flag=0;		
			DemuraTransOnce=180*3;
			USB_Rx_Demura=1; //进入Demura数据写入状态														
		}
		for(i=0;i<USB_ReceivedCount;i++)
		{
			buffer[i+VCP_Receive_True_num] = USB_Rx_Buffer[i];  //
		}
		VCP_Receive_True_num+=USB_ReceivedCount;
		DemuraRecivedNum    +=USB_ReceivedCount;				
		//-----------------------------------------------------------------				
		
		if((VCP_Receive_True_num==DemuraTransOnce)||((DemuraRecivedNum==USB_Rx_Demura_Total_Num))) //写入单笔数据,单次写入DemuraTransOnce个字节
		{												
			if(Demura_first_package_flag==0)
			{
				Demura_first_package_flag=1;
				SSD2828_W_Reg(OLED.SigMode,channel,0xBC,(u16) (DemuraTransOnce+1)); 
				SSD2828_W_Reg(OLED.SigMode,channel,0xBD,(u16)((DemuraTransOnce)>>16)); 	
				//SSD2828_W_Reg(OLED.SigMode,CS_Master,0xBE,(u16) (180*3));
				SSD2828_W_Cmd(OLED.SigMode,channel,0xBF);
				//SSD2828_W_Cmd(OLED.SigMode,channel,0x2C);	
				SSD2828_W_Data(OLED.SigMode,channel,((buffer[0] << 8) + 0x2c));  //模拟2C 
			}
			else
			{
				SSD2828_W_Reg(OLED.SigMode,channel,0xBC,(u16) (VCP_Receive_True_num+1)); 
				SSD2828_W_Reg(OLED.SigMode,channel,0xBD,(u16)((VCP_Receive_True_num)>>16)); 	
				SSD2828_W_Cmd(OLED.SigMode,channel,0xBF);
				//SSD2828_W_Cmd(OLED.SigMode,channel,0x3C);	
				SSD2828_W_Data(OLED.SigMode,channel,((buffer[0] << 8) + 0x3c));  //模拟2C 
				//SSD2828_W_Data(OLED.SigMode,channel,((buffer[0] << 8) + 0x5c)); 
			}											
			SPI_CS_Select(channel,0);
			SSD2828_W_RAM_demura_buffer_part(OLED.pixel_clk,OLED.SigMode,buffer,DemuraTransOnce/3,1,0);
			SPI_CS_Select(channel,1);										
			delay_us(100);
			VCP_Receive_True_num=0;
			
			if(DemuraRecivedNum==USB_Rx_Demura_Total_Num)//最后一笔，状态重置
			{
				Demura_START_FLAG=0;  //清除Demura状态
				DemuraRecivedNum=0; //累计接收统计归零
				USB_Rx_Demura=0;//进入Demura downloading标志
				Demura_first_package_flag=0; //Novatek_NT37701A 4c/5c
				SSD2828_W_Reg(OLED.SigMode,channel,0xC0,0x0001);
			//	STM2PC(pdev,CDC_IN_EP,buf2PC,5+3);           //返回上位机5个byte数据
			}
		}
}



//------------------------------------新的DEMURA流程------------------------------------

void VT6110C_601_Enable_Flash_Control_and_SPI_Flash_En(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	   u8 buffer1[4]; 
	   u16 tmp;
	
      SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);	//Bit 7为0 表示写操作	
			delay_ms(20);    
//	
//			buffer1[0] = 0x02;
//      buffer1[1] = 0x59; 
//			buffer1[2] = 0x11; 
//      SSD2828_W_Array(SigMode,channel,buffer1,0);/////mrak  demura  on status
//			buffer1[0] = 0x02;
//      buffer1[1] = 0x6F; 
//			buffer1[2] = 0x03; 
//      SSD2828_W_Array(SigMode,channel,buffer1,0);///////mark RAM for demura  use
//			buffer1[0] = 0x02;
//      buffer1[1] = 0xBD; 
//			buffer1[2] = 0x00; 
//      SSD2828_W_Array(SigMode,channel,buffer1,0);///////off TITC(RAM compression)
//			delay_ms(300); 
//			buffer1[0] = 0x01;
//      buffer1[1] = 0x28; 
//      SSD2828_W_Array(SigMode,channel,buffer1,0);//////mark display off  ,,--the key setting
//			delay_ms(20);
      buffer1[0] = 0x03;
      buffer1[1] = 0xF0; 
			buffer1[2] = 0xAA; 
			buffer1[3] = 0x10; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);
      buffer1[0] = 0x03;
      buffer1[1] = 0xEA; 
			buffer1[2] = 0x30; 
      buffer1[3] = 0x00;
      SSD2828_W_Array(SigMode,channel,buffer1,0);	   
			buffer1[0] = 0x02;
      buffer1[1] = 0xEE; 
			buffer1[2] = 0xAB; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);
      buffer1[0] = 0x02;
      buffer1[1] = 0xED; 
			buffer1[2] = 0x20; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
			delay_ms(100); 
      buffer1[0] = 0x02;      
      buffer1[1] = 0xED; 
			buffer1[2] = 0x00; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
      buffer1[0] = 0x02; 
      buffer1[1] = 0xEE; 
			buffer1[2] = 0x06; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
      buffer1[0] = 0x02; 
      buffer1[1] = 0xED; 
			buffer1[2] = 0x20; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);
      delay_ms(100); 	
      buffer1[0] = 0x02;       
      buffer1[1] = 0xED; 
			buffer1[2] = 0x00; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
      //read flash id
      buffer1[0] = 0x02;  
      buffer1[1] = 0xEE; 
			buffer1[2] = 0x9F; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);
      buffer1[0] = 0x02; 
      buffer1[1] = 0xED; 
			buffer1[2] = 0x44; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);
      delay_ms(100); 
      buffer1[0] = 0x02; 
      buffer1[1] = 0xED; 
			buffer1[2] = 0x00; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
          
////    /***read***/ 
//    //LP_B7_Data=0200 低速写,  LP_B7_Data|0x0080 将bit7 置1，为读操作
			SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);  // Bit 7为1 表示读操作  
			delay_ms(5);
			Generate_MIPI_Read(pdev,SigMode,channel,0xEC ,3, buffer+4);		

			buffer[0] = 0x2F;
			buffer[1] = 0x06;	

			SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
			STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);    
}


void VT6110C_601_Flash_Check_Demura(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
		 u8 buffer1[10]; 
      
			SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);	
			delay_ms(5);                 
	
			buffer1[0] = 0x03;
      buffer1[1] = 0xFF; 
			buffer1[2] = 0x5A; 
			buffer1[3] = 0x80; 	
      SSD2828_W_Array(SigMode,channel,buffer1,0);
	
			delay_ms(100);
			SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);  // Bit 7为1 表示读操作  
			delay_ms(15);
			Generate_MIPI_Read(pdev,SigMode,channel,0xFA ,10, buffer+4);
      delay_ms(150); 
			SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);	
			
			buffer[0] = 0x2F;
			buffer[1] = 0x04;	
			//SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
			STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);
}

void VT6110C_601_Inter_Demura_Ram(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
		u8 buffer1[5]; 
		u16 tmp;

		SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);
		delay_ms(20);

		buffer1[0] = 0x03;
		buffer1[1] = 0xF0;
		buffer1[2] = 0xAA;
		buffer1[3] = 0x10;
		SSD2828_W_Array(SigMode,channel,buffer1,0);
		buffer1[0] = 0x04;
		buffer1[1] = 0xED;
		buffer1[2] = 0x00;
		buffer1[3] = 0x00;
		buffer1[4] = 0x01;
		SSD2828_W_Array(SigMode,channel,buffer1,0);
		delay_ms(100);
		buffer1[0] = 0x04;
		buffer1[1] = 0xED;
		buffer1[2] = 0x00;
		buffer1[3] = 0x00;
		buffer1[4] = 0x00;
		SSD2828_W_Array(SigMode,channel,buffer1,0);
		delay_ms(100);
		buffer1[0] = 0x02;
		buffer1[1] = 0x65;
		buffer1[2] = 0x05;
		SSD2828_W_Array(SigMode,channel,buffer1,0);
		buffer1[0] = 0x02;
		buffer1[1] = 0xEB;
		buffer1[2] = 0x40;
		SSD2828_W_Array(SigMode,channel,buffer1,0);
		buffer1[0] = 0x02;
		buffer1[1] = 0x65;
		buffer1[2] = 0x0A;
		SSD2828_W_Array(SigMode,channel,buffer1,0);
		buffer1[0] = 0x02;
		buffer1[1] = 0xEA;
		buffer1[2] = 0x10;/////2F--old   10--new
		SSD2828_W_Array(SigMode,channel,buffer1,0);
		delay_ms(10);

		buffer[0] = 0x2F;
		buffer[1] = 0x01;		

//		SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);				////test  HS
		STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);  
}



void VT6110C_601_Flash_Write_Demura(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
  
}

void VT6110C_601_Flash_Write_Demura2(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
   
}

void VT6110C_601_Exit_Demura_Ram(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	  u8 buffer2[12]; 
		u16 temp=0;
	
		delay_ms(2000);
    SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);
		delay_ms(20);	
	
    buffer2[0] = 0x03; 
    buffer2[1] = 0xFF;
    buffer2[2] = 0x5A;
    buffer2[3] = 0x80;
    SSD2828_W_Array(SigMode,channel,buffer2,0);
	
    buffer2[0] = 0x05; 
    buffer2[1] = 0xEE;
    buffer2[2] = 0x32;
		buffer2[3] = 0x00;
		buffer2[4] = 0x01;
		buffer2[5] = 0x00;
    SSD2828_W_Array(SigMode,channel,buffer2,0);
    delay_ms(100);
		buffer2[0] = 0x02; 
    buffer2[1] = 0xED;
    buffer2[2] = 0x02;
    SSD2828_W_Array(SigMode,channel,buffer2,0);
		delay_ms(5000);
		delay_ms(5000);
		do
		{

			buffer2[0] = 0x02; 
			buffer2[1] = 0x65;
			buffer2[2] = 0x07;
			SSD2828_W_Array(SigMode,channel,buffer2,0);
			delay_ms(20);	
			SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);  // Bit 7为1 表示读操作  
			delay_ms(5);
			Generate_MIPI_Read(pdev,SigMode,channel,0xEB ,10, buffer2+0);
			temp = buffer2[0];
			delay_ms(200);
			SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);
			delay_ms(5);
		}while(temp != 0x70);////判断是否IC program done...
	
	
		buffer2[0] = 0x02; 
    buffer2[1] = 0xED;
    buffer2[2] = 0x00;
    SSD2828_W_Array(SigMode,channel,buffer2,0);
		
	  buffer[0] = 0x2F; 
	  buffer[1] = 0x02;
	  SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
  
    buffer[4]=0x70;//向上返回
    STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);  
}
	


void VT6110C_601_Flash_Erase_Demura(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	  //flash enable
      u8 buffer1[4]; 
			u8 VTDR6110C_Read_REG = 0xEF;
	
      SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);	
			delay_ms(5);  
	
	 	  buffer1[0] = 0x01;
			buffer1[1] = 0x28; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(300); 

	 	  buffer1[0] = 0x01;
			buffer1[1] = 0x10; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(300);  
	
		  buffer1[0] = 0x02;
			buffer1[1] = 0x59; 
			buffer1[2] = 0x11; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(100);  
		 	buffer1[0] = 0x02;
			buffer1[1] = 0x6f; 
			buffer1[2] = 0x03; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(300);  
		 
		 	buffer1[0] = 0x01;
			buffer1[1] = 0x11; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(300);  
	

      buffer1[0] = 0x03;
      buffer1[1] = 0xF0; 
			buffer1[2] = 0xAA; 
			buffer1[3] = 0x10; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);
      delay_ms(100);  
	
	    buffer1[0] = 0x02;
			buffer1[1] = 0xBD; 
			buffer1[2] = 0x00; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(100);  
	
	
	
	
      buffer1[0] = 0x03;
			buffer1[1] = 0xEA; 
			buffer1[2] = 0x30; 
      buffer1[3] = 0x01;
      SSD2828_W_Array(SigMode,channel,buffer1,0);	   
			buffer1[0] = 0x02;
      buffer1[1] = 0x65; 
			buffer1[2] = 0x06; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);
      buffer1[0] = 0x02;
			buffer1[1] = 0xEB; 
			buffer1[2] = 0x00; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
      buffer1[0] = 0x03;
			buffer1[1] = 0xED; 
			buffer1[2] = 0x00; 
			buffer1[3] = 0x01; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
			buffer1[0] = 0x03;
			buffer1[1] = 0xED; 
			buffer1[2] = 0x00; 
			buffer1[3] = 0x00; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);
	    delay_ms(100);			
			buffer1[0] = 0x03;
			buffer1[1] = 0xED; 
			buffer1[2] = 0x00; 
			buffer1[3] = 0x10; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);   
      delay_ms(5000);	////实测满数据擦除耗时4.6s，保险起见，设定5s延时
//			SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080); delay_ms(15);
//			do
//			{   
//				Generate_MIPI_Read(pdev,SigMode,channel,VTDR6110C_Read_REG ,1, buffer+4);
//				delay_ms(6);     
//			}while((buffer[4]&0x01)==0x01);
   
      	
      buffer1[0] = 0x03;
      buffer1[1] = 0xED;
			buffer1[2] = 0x00;
      buffer1[3] = 0x00;
      SSD2828_W_Array(SigMode,channel,buffer1,0);
      //不返回	
			buffer[0] = 0x2F;
			buffer[1] = 0x05;		
			buffer[4] = 0x00;	
			SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
			STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);           //êy?Y3¤?è-crcá?×??ú	
}




void VT6110C_601_Demura_Function_ON(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
		u8 buffer1[5]; 
	
		SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);
		delay_ms(5);	
		buffer1[0] = 0x02;
		buffer1[1] = 0x59;
		buffer1[2] = 0x09;
		SSD2828_W_Array(SigMode,channel,buffer1,0);	
    SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
		delay_ms(5);
	
    buffer[0] = 0x2F;
		buffer[1] = 0x07;		
		SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
		STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3); 	
}

void VT6110C_601_Demura_Function_OFF(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
		u8 buffer1[5]; 
	
		SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);
		delay_ms(5);	
		buffer1[0] = 0x02;
		buffer1[1] = 0x59;
		buffer1[2] = 0x00;
		SSD2828_W_Array(SigMode,channel,buffer1,0);	
    SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
		delay_ms(5);
	
    buffer[0] = 0x2F;
		buffer[1] = 0x08;		
		SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
		STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);  	
}




void ProcessForDmuR1D( USBD_HandleTypeDef *pdev,uint8_t ep_addr,u8 SigMode ,u8 channel,u8 buffer[],u16 LP_B7_Data,u16 HS_B7_Data)//ADD BY PCS
{
  switch(buffer[1])
    {
  
			case 0x01:                                      //写寄存器
					VT6110C_601_Inter_Demura_Ram(pdev,CDC_IN_EP,OLED.SigMode ,channel,USB_Rx_Buffer,LP_B7_Data,HS_B7_Data);
			break;	
			case 0x02:                                      //读寄存器
					VT6110C_601_Exit_Demura_Ram(pdev,CDC_IN_EP,OLED.SigMode ,channel,USB_Rx_Buffer,LP_B7_Data,HS_B7_Data);
			break;						 
			case 0x03:                                      //读寄存器
					VT6110C_601_Flash_Write_Demura(pdev,CDC_IN_EP,OLED.SigMode ,channel,USB_Rx_Buffer,LP_B7_Data,HS_B7_Data);
			break;	
			case 0x04:                                      //读寄存器
					VT6110C_601_Flash_Check_Demura(pdev,CDC_IN_EP,OLED.SigMode ,channel,USB_Rx_Buffer,LP_B7_Data,HS_B7_Data);
			break;												
			case 0x05:                                      //读寄存器
					VT6110C_601_Flash_Erase_Demura(pdev,CDC_IN_EP,OLED.SigMode ,channel,USB_Rx_Buffer,LP_B7_Data,HS_B7_Data);
			break;
			case 0x06:                                      //check flash ID
					VT6110C_601_Enable_Flash_Control_and_SPI_Flash_En(pdev,CDC_IN_EP,OLED.SigMode ,channel,USB_Rx_Buffer,LP_B7_Data,HS_B7_Data);
			break;	
			case 0x07:                                      //check flash ID
					VT6110C_601_Demura_Function_ON(pdev,CDC_IN_EP,OLED.SigMode ,channel,USB_Rx_Buffer,LP_B7_Data,HS_B7_Data);
			break;	
			case 0x08:                                      //check flash ID
					VT6110C_601_Demura_Function_OFF(pdev,CDC_IN_EP,OLED.SigMode ,channel,USB_Rx_Buffer,LP_B7_Data,HS_B7_Data);
			break;													
			case 0x0A:
					VT6110C_601_Flash_Write_Demura2(pdev,CDC_IN_EP,OLED.SigMode ,channel,USB_Rx_Buffer,LP_B7_Data,HS_B7_Data);
			break;
			default:
				break;	

    }
}
////////////////////////////////Gamma////////////////////////////////////



void VT6110C_601_Write_Register(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	int  i;
	
  u8 buffer1[buffer[2]+1];
	SSD2828_W_Reg(SigMode,channel,0xB7,(HS_B7_Data|0x0010)&0XFFfd);
	//SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);		
	buffer1[0]=buffer[2];
	for(i=0;i<buffer[2];i++)
	{
			buffer1[i+1] = buffer[i+3];        
	}
	SSD2828_W_Array(SigMode,channel,buffer1,0);	
	STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);      
	SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
	
}
void VT6110C_601_Read_Register(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	u16 tmp;
	u8 buffer1[buffer[2]+1];
	u8 bufferRe[buffer[4]];
	SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);

	SSD2828_W_Reg(SigMode,channel,0xC1,buffer[4]); //返回个数设置	    
	delay_ms(2);			 
	buffer1[0] = 0x02;        
	buffer1[1] = buffer[3];          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA RED GROUP1
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);		
	for(i=0;i<buffer[4];i++)
	{
			SSD2828_W_Cmd(SigMode,channel,0xFA);		
			tmp=SPI3_Read_u16_Data(channel);
			bufferRe[i]=tmp>>8;
			bufferRe[i+1]=tmp;
			delay_ms(5);
			i++;			
	}
		for(i=0;i<buffer[4];i++)
	{
			buffer[i+5] = bufferRe[i];        
	}
	    STM2PC(pdev,CDC_IN_EP,buffer,buffer[4]+5);          //返回 读取的 Gamma数据  ：ok  		

    SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
}

void VT6110C_601_Write_Gamma(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{ 
	u8 buffer1[7];
	u16 tmp;
	u8 i,j;
	SSD2828_W_Reg(SigMode,channel,0xB7,(HS_B7_Data|0x0410)&0XFFFD);
	for(i=0;i<50;i++)
	{
		bufferR[i]=buffer[i+5];
	}
	for(i=0;i<50;i++)
	{
		bufferG[i]=buffer[i+5+50];
	}
	for(i=0;i<50;i++)
	{
		bufferB[i]=buffer[i+5+50+50];
	}
	//		SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);
	
	//delay_ms(5);

	buffer1[0] = 0x03;        
	buffer1[1] = 0xF0;
	buffer1[2] = 0xAA;
	buffer1[3] = 0x13;
	SSD2828_W_Array(SigMode,channel,buffer1,0);	
	delay_ms(20);
	buffer1[0] = 0x02; 			
	buffer1[1] = 0xBF;
	buffer1[2] = buffer[3]; //gamma_group_sel
	SSD2828_W_Array(SigMode,channel,buffer1,0);	
	//R
		
	buffer1[0] = 0x02;        
	buffer1[1] = 0xC4;
	buffer1[2] = 0x01;
	SSD2828_W_Array(SigMode,channel,buffer1,0);					


	SSD2828_W_Reg(SigMode ,channel,0xBC, 17);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xB0);
	for(i = 0; i < 16; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferR[i]);
	}
	SSD2828_W_Reg(SigMode ,channel,0xBC, 17);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xB1);
	for(i = 0; i < 16; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferR[i+16]);
	}
	SSD2828_W_Reg(SigMode ,channel,0xBC, 17);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xB2);
	for(i = 0; i < 16; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferR[i+16+16]);
	}
	SSD2828_W_Reg(SigMode ,channel,0xBC, 3);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xB3);
	for(i = 0; i < 2; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferR[i+16+16+16]);
	}
	//G
	SSD2828_W_Reg(SigMode ,channel,0xBC, 17);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xB4);
	for(i = 0; i < 16; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferG[i]);
	}
	SSD2828_W_Reg(SigMode ,channel,0xBC, 17);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xB5);
	for(i = 0; i < 16; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferG[i+16]);
	}
	SSD2828_W_Reg(SigMode ,channel,0xBC, 17);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xB6);
	for(i = 0; i < 16; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferG[i+16+16]);
	}
	SSD2828_W_Reg(SigMode ,channel,0xBC, 3);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xB7);
	for(i = 0; i < 2; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferG[i+16+16+16]);
	}
	//B
	SSD2828_W_Reg(SigMode ,channel,0xBC, 17);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xB8);
	for(i = 0; i < 16; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferB[i]);
	}
	SSD2828_W_Reg(SigMode ,channel,0xBC, 17);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xB9);
	for(i = 0; i < 16; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferB[i+16]);
	}
	SSD2828_W_Reg(SigMode ,channel,0xBC, 17);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xBA);
	for(i = 0; i < 16; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferB[i+16+16]);
	}
	SSD2828_W_Reg(SigMode ,channel,0xBC, 3);
	SSD2828_W_Reg(SigMode ,channel,0xBD, 0x0000);
	SSD2828_W_Cmd(SigMode ,channel,0xBF);	
	SSD2828_W_Data(SigMode ,channel,0xBB);
	for(i = 0; i < 2; i++)
	{
		SSD2828_W_Data(SigMode ,channel,bufferB[i+16+16+16]);
	}	
	delay_ms(2); 			
	buffer1[2] = 0x02;				
	buffer1[1] = 0xC4;
	buffer1[2] = 0x00;    
	SSD2828_W_Array(SigMode,channel,buffer1,0);
		
	SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);		
	delay_ms(15);
	STM2PC(pdev,CDC_IN_EP,buffer,6);          //返回 读取的 Gamma数据  ：ok 
}

void VT6110C_601_Read_Gamma(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	u8 buffer1[7];
	u16 tmp;
	u8 i,j;

	SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);
	delay_ms(5);	
	buffer1[0] = 0x03;        
	buffer1[1] = 0xF0;
	buffer1[2] = 0xAA;
	buffer1[3] = 0x13;
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	buffer1[0] = 0x02;        
	buffer1[1] = 0xC4;
	buffer1[2] = 0x01;
	SSD2828_W_Array(SigMode,channel,buffer1,0);		
	buffer1[0] = 0x02; 			
	buffer1[1] = 0xBF;
	buffer1[2] = buffer[3]; //gamma_group_sel
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	buffer1[1] = 0xC4;
	buffer1[2] = 0x00;    
	SSD2828_W_Array(SigMode,channel,buffer1,0);		


	delay_ms(5);	

	SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	delay_ms(2);			 
	buffer1[0] = 0x02;        
	buffer1[1] = 0xB0;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA RED GROUP1
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);		
	for(i=0;i<16;i++)
	{
		SSD2828_W_Cmd(SigMode,channel,0xFA);		
		tmp=SPI3_Read_u16_Data(channel);
		bufferR[i]=tmp>>8;
		bufferR[i+1]=tmp;
		delay_ms(5);
		i++;			
	}

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xB1;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA RED GROUP2
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

	for(i=0;i<16;i++)
	{
		SSD2828_W_Cmd(SigMode,channel,0xFA);		
		tmp=SPI3_Read_u16_Data(channel);
		bufferR[i+16]=tmp>>8;
		bufferR[i+17]=tmp;
		delay_ms(5);
		i++;			
	}

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xB2;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA RED GROUP3
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

		for(i=0;i<16;i++)
	{
			SSD2828_W_Cmd(SigMode,channel,0xFA);		
			tmp=SPI3_Read_u16_Data(channel);
			bufferR[i+32]=tmp>>8;
			bufferR[i+33]=tmp;
		delay_ms(5);
			i++;			
	}

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0002); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xB3;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA RED GROUP4
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

		for(i=0;i<2;i++)
	{
			SSD2828_W_Cmd(SigMode,channel,0xFA);		
			tmp=SPI3_Read_u16_Data(channel);
			bufferR[i+48]=tmp>>8;
			bufferR[i+49]=tmp;
		delay_ms(5);
			i++;			
	}

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xB4;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA GREEN GROUP1
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

		for(i=0;i<16;i++)
	{
			SSD2828_W_Cmd(SigMode,channel,0xFA);		
			tmp=SPI3_Read_u16_Data(channel);
			bufferG[i]=tmp>>8;
			bufferG[i+1]=tmp;
		delay_ms(5);
			i++;			
	}

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xB5;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA GREEN GROUP2
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

		for(i=0;i<16;i++)
	{
			SSD2828_W_Cmd(SigMode,channel,0xFA);		
			tmp=SPI3_Read_u16_Data(channel);
			bufferG[i+16]=tmp>>8;
			bufferG[i+17]=tmp;
		delay_ms(5);
			i++;			
	}

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xB6;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA GREEN GROUP3
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

		for(i=0;i<16;i++)
	{
			SSD2828_W_Cmd(SigMode,channel,0xFA);		
			tmp=SPI3_Read_u16_Data(channel);
			bufferG[i+32]=tmp>>8;
			bufferG[i+33]=tmp;
		delay_ms(5);
			i++;			
	}

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0002); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xB7;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA GREEN GROUP4
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

	for(i=0;i<2;i++)
	{
		SSD2828_W_Cmd(SigMode,channel,0xFA);		
		tmp=SPI3_Read_u16_Data(channel);
		bufferG[i+48]=tmp>>8;
		bufferG[i+49]=tmp;
		delay_ms(5);
		i++;			
	}

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xB8;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA BLUE GROUP1
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

		for(i=0;i<16;i++)
	{
			SSD2828_W_Cmd(SigMode,channel,0xFA);		
			tmp=SPI3_Read_u16_Data(channel);
			bufferB[i]=tmp>>8;
			bufferB[i+1]=tmp;
		delay_ms(5);
			i++;			
	}

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xB9;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA BLUE GROUP2
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

		for(i=0;i<16;i++)
	{
			SSD2828_W_Cmd(SigMode,channel,0xFA);		
			tmp=SPI3_Read_u16_Data(channel);
			bufferB[i+16]=tmp>>8;
			bufferB[i+17]=tmp;
		delay_ms(5);
			i++;			
	}

	SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xBA;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA BLUE GROUP3
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

		for(i=0;i<16;i++)
	{
			SSD2828_W_Cmd(SigMode,channel,0xFA);		
			tmp=SPI3_Read_u16_Data(channel);
			bufferB[i+32]=tmp>>8;
			bufferB[i+33]=tmp;
		delay_ms(5);
			i++;			
	}	
	SSD2828_W_Reg(SigMode,channel,0xC1,0x0002); //返回个数设置	    
	delay_ms(2);
			
	buffer1[0] = 0x02;        
	buffer1[1] = 0xBB;          
	SSD2828_W_Array(SigMode,channel,buffer1,0);		 
	delay_ms(2);                 //GAMMA BLUE GROUP3
	SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
	SSD2828_W_Cmd(SigMode,channel,0xFF);
	delay_ms(2);

		for(i=0;i<2;i++)
	{
			SSD2828_W_Cmd(SigMode,channel,0xFA);		
			tmp=SPI3_Read_u16_Data(channel);
			bufferB[i+48]=tmp>>8;
			bufferB[i+49]=tmp;
		delay_ms(5);
			i++;			
	}


	for(j=0;j<50;j++)
	{
		buffer[5+j]=bufferR[j];	  	
	}               			   

	for(j=0;j<50;j++)
	{
		buffer[5+j+50]=bufferG[j];	  		
	}              


	for(j=0;j<50;j++)
	{
		buffer[5+j+50+50]=bufferB[j];								
	}        

			
	buffer[0]=0x6B;	//VTDR6110C
	buffer[1]=0x09;

	delay_ms(15);
	STM2PC(pdev,CDC_IN_EP,buffer,buffer[4]+5);          //返回 读取的 Gamma数据  ：ok  		

	SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
}

void VT6110C_601_Gamma_OTP_Start(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
			u8 buffer1[7];
			SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);	
			delay_ms(5);  
	
		 	buffer1[0] = 0x01;
			buffer1[1] = 0x11; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(100); 
	 	  buffer1[0] = 0x01;
			buffer1[1] = 0x28; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(100); 

		  buffer1[0] = 0x03;
			buffer1[1] = 0xf0; 
			buffer1[2] = 0xaa; 
			buffer1[3] = 0x12; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(10);  
	
		 	buffer1[0] = 0x02;
			buffer1[1] = 0xca; 
			buffer1[2] = 0x01; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(10);  
			
			buffer1[0] = 0x04;
			buffer1[1] = 0xe6; 
			buffer1[2] = 0x00; 
			buffer1[3] = 0x00; 
			buffer1[4] = 0x80; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(100);  
			
			buffer1[0] = 0x04;
			buffer1[1] = 0xe7; 
			buffer1[2] = 0x88; 
			buffer1[3] = 0x55; 
			buffer1[4] = 0x11; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(2000);  
			
			buffer1[0] = 0x05;
			buffer1[1] = 0xe6; 
			buffer1[2] = 0x00; 
			buffer1[3] = 0x00; 
			buffer1[4] = 0x00; 
			buffer1[5] = 0x00; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(100); 
		 
		  buffer1[0] = 0x02;
			buffer1[1] = 0xca; 
			buffer1[2] = 0x00; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(10);  
			buffer1[0] = 0x02;
			buffer1[1] = 0xca; 
			buffer1[2] = 0x40; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(10);  
			
		 	buffer1[0] = 0x01;
			buffer1[1] = 0x01; 
      SSD2828_W_Array(SigMode,channel,buffer1,0);	
	    delay_ms(100);  
			
			SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
			STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);
	
}


void VT6110C_601_OTP_Flash(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	 
}


void ProcessForIc6B( USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8 buffer[],u16 LP_B7_Data,u16 HS_B7_Data)
{	
	switch(buffer[1])
	{
		case 0x01:                                      //写寄存器
			VT6110C_601_Write_Register(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);break;	
		case 0x02:                                      //读寄存器
			VT6110C_601_Read_Register(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);break;		
		case 0x03:                                      //读寄存器                                      //写Gamma数据    
			VT6110C_601_Write_Gamma(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);break;
		case 0x09:                                      //读Gamma数据
			VT6110C_601_Read_Gamma(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);break; 
		case 0x0D://OTP Gamma
			VT6110C_601_Gamma_OTP_Start(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);  break;
    default:	break;	
	}	
}


